package org.example.employ_api.controller;

import lombok.RequiredArgsConstructor;
import org.example.employ_api.dto.ExperienceSearchDto;
import org.example.employ_api.dto.GraduateInfoDto;
import org.example.employ_api.service.ExperienceService;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/experiences")
@RequiredArgsConstructor
public class ExperienceController {
    
    private final ExperienceService experienceService;

    @GetMapping("/search")
    public ResponseEntity<Page<GraduateInfoDto>> searchExperiences(
            @RequestParam(required = false) String major,
            @RequestParam(required = false) String careerPath,
            @RequestParam(required = false) String experienceType,
            @RequestParam(required = false) String keyword,
            @RequestParam(defaultValue = "0") int page,
            @RequestParam(defaultValue = "10") int size) {
        
        ExperienceSearchDto searchDto = new ExperienceSearchDto();
        searchDto.setMajor(major);
        searchDto.setCareerPath(careerPath);
        searchDto.setExperienceType(experienceType);
        searchDto.setKeyword(keyword);
        searchDto.setPage(page);
        searchDto.setSize(size);
        
        return ResponseEntity.ok(experienceService.searchExperiences(searchDto));
    }
} 